const mongoose = require('./db');

const userSchema = new mongoose.Schema({
    username:String,
    phone:String,
    fans:Number,
    concern:Number,
    collection:Number,
    sex:String
})

const userModel = mongoose.model('user',userSchema,'user');




const cateSchema = new mongoose.Schema({
    name:String,
    image:String
})
const cateModel = mongoose.model('cate',cateSchema,'cate');


const topicSchema = new mongoose.Schema({
    name:String,
    image:String
})
const topicModel = mongoose.model('topic',topicSchema,'topic');




const opusSchema = new mongoose.Schema({
    name:String,
    price:Number,
    address:String,
    brief:String,
    cate_id:{
        type:mongoose.Types.ObjectId,
        ref:'cate'
    },
    topic_id:{
        type:mongoose.Types.ObjectId,
        ref:'topic'
    },
    distance:String,
    singer_id:String,
    img:String
})
const opusModel = mongoose.model('opus',opusSchema,'opus');



const areaSchema = new mongoose.Schema({
    name:String,
    phone:String,
    address:String,
    flag:Boolean
})
const areaModel = mongoose.model('area',areaSchema,'area');



const infoSchema = new mongoose.Schema({
    name:String,
    phone:String,
    idcard:String
})
const infoModel = mongoose.model('info',infoSchema,'info');


const ordersSchema = new mongoose.Schema({
    name:String,
    price:String,
    address:String,
    time:String,
    area_id:{
        type:mongoose.Types.ObjectId,
        ref:'area'
    },
    spectator_id:{
        type:mongoose.Types.ObjectId,
        ref:'info'
    },
    num:Number,
    flag:Boolean,
    img:String
})
const ordersModel = mongoose.model('orders',ordersSchema,'orders');


const singerSchema = new mongoose.Schema({
    name:String,
    img:String,
    desc:String,
    fans:String
})
const singerModel = mongoose.model('singer',singerSchema,'singer');



module.exports = {
    userModel,
    cateModel,
    topicModel,
    opusModel,
    areaModel,
    infoModel,
    ordersModel,
    singerModel
}